package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.SysWxOperateRecord;
import com.ruoyi.system.service.ISysWxOperateRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * wx操作状态记录Controller
 * 
 * @author ruoyi
 * @date 2024-04-27
 */
@RestController
@RequestMapping("/system/wxoperaterecord")
public class SysWxOperateRecordController extends BaseController
{
    @Autowired
    private ISysWxOperateRecordService sysWxOperateRecordService;

    /**
     * 查询wx操作状态记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:wxoperaterecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysWxOperateRecord sysWxOperateRecord)
    {
        startPage();
        List<SysWxOperateRecord> list = sysWxOperateRecordService.selectSysWxOperateRecordList(sysWxOperateRecord);
        return getDataTable(list);
    }

    /**
     * 导出wx操作状态记录列表
     */
    @PreAuthorize("@ss.hasPermi('system:wxoperaterecord:export')")
    @Log(title = "wx操作状态记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysWxOperateRecord sysWxOperateRecord)
    {
        List<SysWxOperateRecord> list = sysWxOperateRecordService.selectSysWxOperateRecordList(sysWxOperateRecord);
        ExcelUtil<SysWxOperateRecord> util = new ExcelUtil<SysWxOperateRecord>(SysWxOperateRecord.class);
        util.exportExcel(response, list, "wx操作状态记录数据");
    }

    /**
     * 获取wx操作状态记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:wxoperaterecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(sysWxOperateRecordService.selectSysWxOperateRecordById(id));
    }

    /**
     * 新增wx操作状态记录
     */
    @PreAuthorize("@ss.hasPermi('system:wxoperaterecord:add')")
    @Log(title = "wx操作状态记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysWxOperateRecord sysWxOperateRecord)
    {
        return toAjax(sysWxOperateRecordService.insertSysWxOperateRecord(sysWxOperateRecord));
    }

    /**
     * 修改wx操作状态记录
     */
    @PreAuthorize("@ss.hasPermi('system:wxoperaterecord:edit')")
    @Log(title = "wx操作状态记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysWxOperateRecord sysWxOperateRecord)
    {
        return toAjax(sysWxOperateRecordService.updateSysWxOperateRecord(sysWxOperateRecord));
    }

    /**
     * 删除wx操作状态记录
     */
    @PreAuthorize("@ss.hasPermi('system:wxoperaterecord:remove')")
    @Log(title = "wx操作状态记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysWxOperateRecordService.deleteSysWxOperateRecordByIds(ids));
    }
}
